<?php

$obj=new mysql($config);
if(!empty($_POST)){
      $email=$_POST['email'];
      $password=md5($_POST['password']);
      $sql="select * from `user` where `email`='$email' and `password`='$password'";
      $row=$obj->getOne($sql);
      if($row){
            
             if($row['state']==1){
             $obj->update(array('logintime'=>time()),array('id'=>$row['id']),'user');
             $_SESSION['user']=$row;
             echo "<script>alert('登录成功!');location.href='index.php';</script>";
             }else{
             echo "<script>alert('邮箱未验证，请登录邮箱进行验证！');window.reload();</script>";
             }
      	
      }else{
      	echo "<script>alert('邮箱或密码有误');window.reload();</script>";
      }
}





require_once VIEW_PATH.'home/layout.html';
